package cn.pojo;

import lombok.Data;

import java.util.List;

@Data
public class Page {
    /*当前页*/
    private Integer pageNum;
    /*总记录条数*/
    private int totalNum;
    /*每页显示条数*/
    private int pageSize=5;
    /*每页的开始记录数*/
    private int startIndex;
    /*开始页和结束页*/
    private int startPage=1;
    private int endPage;
    /*前台传入*/
    private String url;
    /*总页数*/
    private int totalPageNum;

    private List<?> list = null;

    public Page() {
    }

    public Page(Integer pageNum, int totalNum, String url){
        this.pageNum = pageNum;
        this.totalNum = totalNum;
        this.url = url;
        /*判断总页数*/
        if(totalNum%pageSize==0){
            totalPageNum = totalNum/pageSize;
        }else{
            totalPageNum = totalNum/pageSize+1;
        }
        /*判断每页其实数据*/
        startIndex = (pageNum-1)*pageSize;
        this.endPage=totalPageNum;
    }
}
